Skip to content

Add GitHub Actions CI (build + format check on PRs) - #2

Merged
TheValiantOne merged 1 commit into
mainfrom
chore/add-github-actions-ci
Aug 7, 2026
Merged

Add GitHub Actions CI (build + format check on PRs)#2
TheValiantOne merged 1 commit into
mainfrom
chore/add-github-actions-ci

Conversation

@TheValiantOne

Copy link
Copy Markdown
Owner

What

Adds .github/workflows/build.yml: a GitHub Actions workflow that, on every pull request targeting main, on a windows-latest runner (required for UseWindowsForms=true):

  1. Checks out the repo.
  2. Installs the .NET 10 SDK (dotnet-version: '10.0.x'), matching the project's net10.0-windows7.0 TFM.
  3. Runs dotnet restore + dotnet build WitcherScriptMerger.sln --configuration Release.
  4. Runs dotnet format whitespace WitcherScriptMerger.sln --verify-no-changes.

Also lightly updates CONTRIBUTING.md's pre-PR verification bullet to mention this now runs automatically in CI (still tells contributors to run it locally first, since CI failing shouldn't be the first time you find out).

Why

HANDOFF.md (gitignored, local project-history notes — not part of this diff) explicitly calls out that this repo has no CI at all and recommends exactly this workflow as a prerequisite before adding it as a required status check on main's branch protection. Today, dotnet build and dotnet format whitespace --verify-no-changes are manual, undocumented-until-a-human-remembers steps; this makes them automatic on every PR.

I did not touch branch protection / required status checks — that's a GitHub repo-settings change outside code and outside a contributor's permissions. Once this workflow has merged and run successfully at least once, the repo owner should consider adding "Build & format check" as a required status check on main (currently required_status_checks: null).

A note on line endings

This repo commits .cs files as LF (no .gitattributes) but .editorconfig mandates end_of_line = crlf, and locally that's reconciled by core.autocrlf=true converting LF→CRLF on checkout. dotnet format whitespace enforces the CRLF rule. Since a CI runner's git config is not guaranteed to default to autocrlf=true, the workflow explicitly sets git config --global core.autocrlf true before actions/checkout@v4 so the format check sees the same line endings CI would see on a normal Windows dev box. I verified the failure mode this guards against by temporarily converting a tracked .cs file to LF-only in a working copy and re-running the format command — it fails hard with an ENDOFLINE diagnostic on every line of that file, confirming this isn't a false safety net.

How I verified it

  • YAML validity: downloaded actionlint (v1.7.7) and ran it against the workflow — zero findings.
  • Local build parity: ran dotnet build WitcherScriptMerger.sln --configuration Release twice — once under the SDK already selected on this machine (an unrelated 11.0 preview picked up in the absence of a global.json), and again with a throwaway (never committed) global.json pinning 10.0.204, to match what CI's setup-dotnet@v4 step will actually install. Both succeeded with the same 7 pre-existing warnings (CA1823/NU1510) already on main — no new warnings introduced by this change.
  • Local format-check parity: ran dotnet format whitespace WitcherScriptMerger.sln --verify-no-changes under the pinned 10.0.204 SDK — passes clean (0 changes needed), confirming the CI step will pass against main's current state.
  • code-review skill: ran it against the diff; addressed its two actionable findings (CONTRIBUTING.md's local verification command now matches CI's --configuration Release exactly; added setup-dotnet's NuGet cache, keyed off the .csproj since there's no packages.lock.json). Its third finding (the new YAML file itself is LF, seemingly against .editorconfig) turned out to be a false positive — checked git cat-file -p HEAD:.editorconfig and confirmed the repo's own .editorconfig is also committed as LF; non-.cs files are apparently committed LF in this repo already (autocrlf handles the working-tree presentation), so the new workflow file matches existing convention, not violates it.
  • End-to-end trigger: confirmed Actions are enabled on this fork (gh api repos/TheValiantOne/WitcherScriptMerger/actions/permissionsenabled: true) before pushing, then pushed the branch and opened this PR to let the workflow run for real against a live PR — see the Checks tab on this PR for the actual outcome (reporting it in my agent summary regardless of pass/fail, per the verification bar this repo holds AI-assisted changes to).

AI assistance disclosure

This PR (workflow YAML, the CONTRIBUTING.md edit, and all verification steps above) was produced by a Claude Code agent per CONTRIBUTING.md's AI-assisted-development section. Commits carry the standard Co-Authored-By trailer.

Runs dotnet build and dotnet format whitespace --verify-no-changes on
every PR targeting main, per the recommendation in HANDOFF.md. Also
normalizes checkout line endings to CRLF (git config --global
core.autocrlf true) so the format check sees the same line endings on
the windows-latest runner as a local Windows dev machine, since .cs
files are committed as LF with no .gitattributes to normalize them.

Lightly updates CONTRIBUTING.md's pre-PR verification note to mention
this now also runs automatically in CI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXAuGMLB44T5Zv5o5ZzKah
@TheValiantOne
TheValiantOne merged commit 570fcdb into main Aug 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant